using UnityEngine;

//移动
//sealed修饰符会阻止其他类从该类继承
public sealed class movementShapebehavior : ShapeBehavior
{
    //移动速度矢量属性
    public Vector3 Velocity{get;set;}

    public override void GameUpdate(Shape shape)
    {
        shape.transform.localPosition += Velocity * Time.deltaTime;    
    }

    public override void Save(GameDataWriter writer)
    {
        writer.Write(Velocity);
    }

    public override void Load(GameDataReader reader)
    {
        Velocity = reader.ReadVector3();
    }

    public override ShapeBehaviorType BehaviorType
    {
        get{
            return ShapeBehaviorType.Movement;
        }
    }

    public override void Recycle()
    {
        ShapeBehaviorPool<movementShapebehavior>.Reclaim(this);
    }
    
}